<?php slot('submenu') ?>
<div class="search">
        <?php echo link_to('Thống kê chung', '/alert/commonStatistic'); ?>&nbsp;&nbsp;
        <?php echo link_to('Tổng doanh thu theo ngày', '/alert/dailyDownloadContent'); ?>&nbsp;&nbsp;
	<strong>Tổng doanh thu theo tháng</strong>&nbsp;&nbsp;
	<?php echo link_to('Cảnh báo Ringtone', '/ringtone_alert/list'); ?>
</div>
<?php end_slot() ?>
<div id="sf_admin_container">

	<div id="sf_admin_content" >
	
		<form id="frmCommon" method="POST" action="monthlyDownloadContent" >
			<fieldset>
                                <div class="form-row">
                                    &nbsp;&nbsp;
                                </div>
                                <!-- 
                                <div class="form-row">
                                    <?php                                        
                                        $value1 = isset($startDate) ? $startDate : null;
                                        $value2 = isset($endDate) ? $endDate : null;
                                        $options = array (
                                                                  'rich' => true,                                                                  
                                                                  'calendar_button_img' => '/sf/sf_admin/images/date.png',
                                                                );
                                        $options = _parse_attributes($options);
                                        $before = _get_option($options, 'before', '');
                                        $middle = _get_option($options, 'middle', '');
                                        $after  = _get_option($options, 'after', '');
                                    ?>
                                    <label>Từ ngày</label>
                                    <?php
                                        echo $before.
                                         input_date_tag('start_date',$value1 , $options).
                                         $middle;
                                    ?>                                    
                                </div>
                                <div class="form-row">
                                    <label>Đến ngày</label>
                                    <?php
                                        echo input_date_tag('end_date', $value2, $options).
                                             $after;
                                    ?>
                                </div> -->
				<div class="form-row">
					<label>Loại</label>
					<select name="type" style="width: 110px;">
                                            <option value="0" <?php if ($type == 0) echo "selected=''"; ?> > Tất cả </option>
                                            <option value="1" <?php if ($type == 1) echo "selected=''"; ?> > Nhạc chờ </option>
                                            <option value="2" <?php if ($type == 2) echo "selected=''"; ?> > Nhạc chuông </option>
					</select>
				</div>
				<div class="form-row">
					<label>Nguồn</label>
					<select name="source_type" style="width: 110px;">
                                            <option value="0" <?php if ($sourceType == 0) echo "selected=''"; ?> > Tất cả </option>
                                            <option value="1" <?php if ($sourceType == 1) echo "selected=''"; ?> > FRST </option>
                                            <option value="2" <?php if ($sourceType == 2) echo "selected=''"; ?> > CRBT </option>
					</select>
				</div>
				<div class="form-row">
					<label>Giá</label>
					<select name="price"  style="width: 80px;" >
                                            <option value="3000" <?php if ($price == 3000) echo "selected=''"; ?> > 3000đ </option>
					</select>
				</div>
				
				<div class="form-row" style="clear:both;">
					<?php echo submit_tag('Thực hiện', 'style="width:80px"') ?>
				</div>				 
			</fieldset>
		</form>	
	
            <label><strong>Kết quả thực hiện: </strong></label><label>(<?php echo count($ringtoneDownloads) ?>) kết quả</label>
     <div style="clear: both;">
		<div  id="result_search" style ="padding:20px 0 0 5px; float: left;">
				  <table cellpadding="0" class="user-infor" style="width:450px">
				  	<tbody>
                                        <tr>
                                                <th>Tháng</th>
                                                <th>Lượt tải</th>
                                                <th>Tổng tiền (VND)</th>
                                        </tr>
                                <?php if (count($ringtoneDownloads) > 0): ?>
					<?php  $i = 1; foreach ($ringtoneDownloads as $ringtoneDownload): $odd = fmod(++$i, 2) ?>
						<tr class="user-row<?php echo $odd ?>">	
                                                    <td>
                                                        <?php echo $ringtoneDownload['month'].'/'.$ringtoneDownload['year'];?>
                                                    </td>
                                                    <td>
                                                        <?php echo $ringtoneDownload['totalDownload'];?>
                                                    </td>
                                                    <td>
                                                        <?php echo $ringtoneDownload['totalMoney']."đ";?>
                                                    </td>
						</tr>						
					<?php endforeach; ?>                               
                                <?php endif; ?>
					</tbody>
				</table>	
		</div>
		<?php if (count($ringtoneDownloads) > 0): ?>
		<div style="width: 800px; padding-top: 20px; float: left; padding-left: 20px;">
		 	<object id="my_chart" width="100%" height="400" type="application/x-shockwave-flash" data="/flash/open-flash-chart.swf" style="visibility: visible;">
				<param name="flashvars" value="data-file=/flash/charts_data/monthly_<?php echo $sf_user->getUserName(); ?>.json">
			</object>						
		</div>
		<?php endif; ?>	
	</div>
	</div>
</div>